#include<cstdio>
bool vis[10];
inline bool pd(int a,int b,int c)
{
    if(2*a==b&&3*a==c)return 1;
    return 0;
}
int main()
{
    for(int i=1;i<=9;i++)
    {
        vis[i]=1;
        for(int j=1;j<=9;j++)
        {
            if(vis[j]==1)continue;
            else vis[j]=1;
            for(int k=1;k<=9;k++)
            {
                if(vis[k]==1)continue;
                else vis[k]=1;
                for(int l=1;l<=9;l++)
                {
                    if(vis[l]==1)continue;
                    else vis[l]=1;
                    for(int ii=1;ii<=9;ii++)
                    {
                        if(vis[ii]==1)continue;
                        else vis[ii]=1;
                        for(int jj=1;jj<=9;jj++)
                        {
                            if(vis[jj]==1)continue;
                            else vis[jj]=1;
                            for(int kk=1;kk<=9;kk++)
                            {
                                if(vis[kk]==1)continue;
                                else vis[kk]=1;
                                for(int ll=1;ll<=9;ll++)
                                {
                                    if(vis[ll]==1)continue;
                                    else vis[ll]=1;
                                    for(int last=1;last<=9;last++)
                                    {
                                        if(vis[last]==1)continue;
                                        else vis[last]=1;
                                        int a=100*i+10*j+k;
                                        int b=100*l+10*ii+jj;
                                        int c=100*kk+10*ll+last;
                                        if(pd(a,b,c))
                                            printf("%d %d %d\n",a,b,c);
                                        vis[last]=0;
                                    }
                                    vis[ll]=0;
                                }
                                vis[kk]=0;
                            }
                            vis[jj]=0;
                        }
                        vis[ii]=0;
                    }
                    vis[l]=0;
                }
                vis[k]=0;
            }
            vis[j]=0;
        }
        vis[i]=0;
    }
    return 0;
}
